/**
 * Project: lionbule-compile
 * 
 * File Created at 2012-4-8
 * $Id$
 * 
 * Copyright 1999-2100 Alibaba.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package com.antlr.sample;

import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.tree.BaseTree;

/**
 * SimpleCalc.
 * 
 * @author LionBule 2012-4-8 下午9:13:13
 */
public class SimpleCalc {

    public static void main(String[] args) throws Exception {
        String expr = "4/2+2*3+96;";
        ANTLRStringStream input = new ANTLRStringStream(expr);
        SimpleCalcLexer lexer = new SimpleCalcLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lexer);

        SimpleCalcParser parser = new SimpleCalcParser(tokens);
        SimpleCalcParser.statments_return rs = parser.statments();
        System.out.println(((BaseTree) rs.getTree()).toStringTree());
    }

}
